-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Math.Tau, MathF.Tau #37517
Add Math.Tau, MathF.Tau #37517
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Neither |
@@ -2532,6 +2532,7 @@ public static partial class Math | |||
{ | |||
public const double E = 2.718281828459045; | |||
public const double PI = 3.141592653589793; | |||
public const double Tau = 6.283185307179586; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting for anyone that comes looking, the value we put in the src
is the actual value of PI to at least 17 significant digits + 1 rounding digit (or to at least 9 significant digits + 1 rounding digit for float
).
The value here is the actual double
or float
value (which may be different due to rounding as the actual value may not be exactly representable) formatted as a string with at least enough precision to correctly roundtrip. Hence why the ref float
versions differ slightly from the "true digits" of PI or TAU
REF FLT: 3.1415927
SRC FLT: 3.1415926 5
REF DBL: 3.1415926 53589793
SRC DBL: 3.1415926 53589793 23846
TRU PI: 3.1415926 53589793 23846 2643383279502884197169399375105820974...
REF FLT: 6.2831855
SRC FLT: 6.2831853 07
REF DBL: 6.2831853 07179586
SRC DBL: 6.2831853 07179586 476925
TRU TAU: 6.2831853 07179586 476925 286766559005768394338798750211641949...
Should this be placed on the 5.0 milestone, since I assume it will be available in .NET 5? |
Added
Math.Tau
andMathF.Tau
constants. Tests forMath/F.E
andMath/F.PI
were also introduced to check they are the expected value for consistency 😄Fixes #24678